UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sJG2iasAggkmijHFmsfwe4oyTipBHD+NBXajqYi8l1I=' 
WHERE 
  key_id = '466b821843e7f141af3569f5f21989d21aad9d81c48acca38432230805cec157' 
  AND (
    token = 'sJG2iasAggkmijHFmsfwe4oyTipBHD+NBXajqYi8l1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029