UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kXz4kl+mMvU2m2exTk+FTkhZH1t1ilcHN6yivBW2h70=' 
WHERE 
  key_id = '494947f165605512958ea2be8555a984ea942054d07213a5305445dc800ad521' 
  AND (
    token = 'kXz4kl+mMvU2m2exTk+FTkhZH1t1ilcHN6yivBW2h70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019