UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BqZPLncWiqkFCfKH1uJXNEx/7l1+l/qrns6Q6es1kzE=' 
WHERE 
  key_id = '2aee1a7241401cf257c74b3ab71975f0df199f710780cdffa50756ff77d98ff8' 
  AND (
    token = 'BqZPLncWiqkFCfKH1uJXNEx/7l1+l/qrns6Q6es1kzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031