UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X4ZRB0BGGB2lEEhQnkOzzn5K/pWebWipMiJ4E9kvKAM=' 
WHERE 
  key_id = '8a5234f8d49f29401d5db746cc7568374ddf284853d1296760d78b6873d55d6e' 
  AND (
    token = 'X4ZRB0BGGB2lEEhQnkOzzn5K/pWebWipMiJ4E9kvKAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030