UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OpZsSxDII2Ny8eojzD2Um7sm7W8VAZTpu/luNi2nvpA=' 
WHERE 
  key_id = '0e01871155602b90a8d9a837fad86e164e4846a20deed7e011df243cddc87572' 
  AND (
    token = 'OpZsSxDII2Ny8eojzD2Um7sm7W8VAZTpu/luNi2nvpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041