UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0H7WXd9erOqUyc8cPmSQiw/agx+O4RdLawtSVijLTk=' 
WHERE 
  key_id = 'cc8733f4d30ee64b36cb50f155e6f1dacaf7f99cc2f2209fcd0c12d8ff2df44d' 
  AND (
    token = 'l0H7WXd9erOqUyc8cPmSQiw/agx+O4RdLawtSVijLTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028