UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwvyZmcCMkiyEcrV2GbR741FjqAOBJNaPKXO837gJ6k=' 
WHERE 
  key_id = 'b63f274993d09ed8093e834f84990c3c27fea275e9f38dd5d3a66f7c061c9e29' 
  AND (
    token = 'iwvyZmcCMkiyEcrV2GbR741FjqAOBJNaPKXO837gJ6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032