UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cL37JCHGcEJMBbr1GNThKE/7jeFb/HB5qynuu9MId7s=' 
WHERE 
  key_id = '789fcbfbb24e478202aaa79b863e77d300501b8a8a51a1a4b6ca2e9ffcb52d20' 
  AND (
    token = 'cL37JCHGcEJMBbr1GNThKE/7jeFb/HB5qynuu9MId7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037