UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CMCCrF95a8EPwjO/fTcx57LsWAZqdd6orKQ9TGYGhPw=' 
WHERE 
  key_id = '4f018b54009e024b5ee67f273ed34022970299201f6e5d12f7bdc3ba87191e24' 
  AND (
    token = 'CMCCrF95a8EPwjO/fTcx57LsWAZqdd6orKQ9TGYGhPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022