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

Query time 0.00050