UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vu9/5huHBzELt4Z+xIppr6PHBQbKzgPjfVd8MOLj3Fs=' 
WHERE 
  key_id = '12aedba6af7bbabadfb546d0dc1d9ec9939eb85b88673d04d065affb0a20158a' 
  AND (
    token = 'Vu9/5huHBzELt4Z+xIppr6PHBQbKzgPjfVd8MOLj3Fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016