UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q40ZsWcUC2Nv+p1OXcAKZaiSz8bzPYnX8ejvlWbyYXE=' 
WHERE 
  key_id = 'd2bc278d8d076bedcac8347990f59feac4fff5ce6c82627021a8deb4359a46a1' 
  AND (
    token = 'Q40ZsWcUC2Nv+p1OXcAKZaiSz8bzPYnX8ejvlWbyYXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00091