UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6Eg7E+w4ICRc5VTilISgVmhcixObzArd0s56mpGeNo=' 
WHERE 
  key_id = '79246c7f1782201cd6b915575cfedb38883e50a95aed99fa736eac5ddd86f3c4' 
  AND (
    token = 'H6Eg7E+w4ICRc5VTilISgVmhcixObzArd0s56mpGeNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022