UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SBgKqU990IDfC82nnjPjbS/a6CyGGUBaxm7g2dMfN7Q=' 
WHERE 
  key_id = '7acd23613d156005d0b405f1ac770baff6535f6aca566b18048ce6362a1bb288' 
  AND (
    token = 'SBgKqU990IDfC82nnjPjbS/a6CyGGUBaxm7g2dMfN7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045