UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i1qtq8XChGrIer/4v7ItThrZJBlv8ns94YueFtZUs/I=' 
WHERE 
  key_id = '8a20a0045a273c304fed03b9b18a15590b7bd1b44fd5aef4276935ab7605e9b8' 
  AND (
    token = 'i1qtq8XChGrIer/4v7ItThrZJBlv8ns94YueFtZUs/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020