UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sEMlfCl0OKXSD4ODT7kc+tMoH8duLxwfXlXJGrgkoaE=' 
WHERE 
  key_id = '39b68560a5545d110733494cd6efe164a821f80828a80de8c2d1276a93c7881e' 
  AND (
    token = 'sEMlfCl0OKXSD4ODT7kc+tMoH8duLxwfXlXJGrgkoaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017