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

Query time 0.00032