UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '39MPxkLFlQM5XiMPcVeDM9DpMHCly/0ge0BnCZEom5s=' 
WHERE 
  key_id = '10260fc4e50bbe5562663606fe66e5beed9708de4d4f13df21645a40a04fbbe5' 
  AND (
    token = '39MPxkLFlQM5XiMPcVeDM9DpMHCly/0ge0BnCZEom5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038