UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ih+r9qGGevmF4TxevY7V6L3ZjWnaS/2CYy8i5Lj7s5k=' 
WHERE 
  key_id = '65264f519ab351889f7a3009e41103af6fb1294c6f9dadd3d585522a24ddac64' 
  AND (
    token = 'ih+r9qGGevmF4TxevY7V6L3ZjWnaS/2CYy8i5Lj7s5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054