UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dN6PSNYmTJ+uEOo4061txMl67DHc5OjrUO0YMUD+IYs=' 
WHERE 
  key_id = 'c87d8ac6ec7c2b537adabe902e83e5b43efbd78c51bc5fa1aac075ab326e586e' 
  AND (
    token = 'dN6PSNYmTJ+uEOo4061txMl67DHc5OjrUO0YMUD+IYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021