UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yikhlGTpa9EB0usB+5Thyyg2B+gaU3V0LiYO7rt6T9Q=' 
WHERE 
  key_id = 'ce3fcf1317fa111a9c34969615bae6c362d4ad55733aebb9f40719e962213e8a' 
  AND (
    token = 'yikhlGTpa9EB0usB+5Thyyg2B+gaU3V0LiYO7rt6T9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016