UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X/f2twDYgd5AvqBPtUSuTxr64kplwuF0HnrbSmjkRoQ=' 
WHERE 
  key_id = '2a26bbe64d8d233c6134b3c1f20fe18428794106ee3df62c5d0d6cac4e7aa25d' 
  AND (
    token = 'X/f2twDYgd5AvqBPtUSuTxr64kplwuF0HnrbSmjkRoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025