UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lIpHocWZoyyJD0uO7qJ/t2sjUaF9PKa4Ovu5n4qA7fA=' 
WHERE 
  key_id = '42b98c22dc27975f05e28679667d3475f2cff38364d936f7bc1e7634e2a109c5' 
  AND (
    token = 'lIpHocWZoyyJD0uO7qJ/t2sjUaF9PKa4Ovu5n4qA7fA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032