UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k9JC3PD1hQtMRkctKkwOJ/42TCj8PT79zKFo+5frtWU=' 
WHERE 
  key_id = '0e12715b4c7bd0080932dbd0fc09476bc11817c2100227f277ceb9035fb9e2d2' 
  AND (
    token = 'k9JC3PD1hQtMRkctKkwOJ/42TCj8PT79zKFo+5frtWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018