UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HECXbJkh5uRyL0r2YuPMluzNGZuewKQIuwRIs6CNOTc=' 
WHERE 
  key_id = 'dc622ad45de937cd8b06d20389761318517945d2406b9b0a71d32eb812d4011d' 
  AND (
    token = 'HECXbJkh5uRyL0r2YuPMluzNGZuewKQIuwRIs6CNOTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076