UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vGjQa3B36YbOepRehNAOLEVpysRvcefrvTvI1cmXeHs=' 
WHERE 
  key_id = 'b0983b7ec366f346b2a4ec2fa578db406885f4a88165d73538dfc7f5d31cae36' 
  AND (
    token = 'vGjQa3B36YbOepRehNAOLEVpysRvcefrvTvI1cmXeHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044