UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UaRBftn+ghMNInO8oL4Np0LZOd4y4AKMWT4iaUMjFNU=' 
WHERE 
  key_id = '5061b2f9fda794dec00f4af3ce8a87c69f5ef9d93e810ab408e500cd4a7e332f' 
  AND (
    token = 'UaRBftn+ghMNInO8oL4Np0LZOd4y4AKMWT4iaUMjFNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033