UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BmqdsoEg4T1JSGiVr9PuhxVyVglDV5DIRRfSsFHEiaU=' 
WHERE 
  key_id = '86606f1d65b31b04cbb6243a44f7ebab3a59794d775fb02eb5d30d3fe21b1596' 
  AND (
    token = 'BmqdsoEg4T1JSGiVr9PuhxVyVglDV5DIRRfSsFHEiaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029