UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Di+IyQCnwPzfoQf8ZiEGl2KpM6C3mTPiYE0dyxOhqqk=' 
WHERE 
  key_id = '794e505d18589ae3a7cbd336ad194b4baf20229ec5141d057fc28c273b4762db' 
  AND (
    token = 'Di+IyQCnwPzfoQf8ZiEGl2KpM6C3mTPiYE0dyxOhqqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021