UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DiF8F2TxrWXHkqiPZF+xfqNH0bDWWwRTfshYllAFXjE=' 
WHERE 
  key_id = '6b3936df76956642232341d3e948215f1e8a4288db71939c885dc88882d088a4' 
  AND (
    token = 'DiF8F2TxrWXHkqiPZF+xfqNH0bDWWwRTfshYllAFXjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041