UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jc4t0mFwWEbUk+eslniFST1O+WUuYhbnJ052OcRNR9A=' 
WHERE 
  key_id = 'e3e8e489fd0afcfdfdcecce22164cada287c64bbf4a16834f773f5b12753ba31' 
  AND (
    token = 'Jc4t0mFwWEbUk+eslniFST1O+WUuYhbnJ052OcRNR9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034