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

Query time 0.00031