UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OOb/H0P3sus8hVxtJmOJ3p/M15pHb1fq+qaD5+WTz4w=' 
WHERE 
  key_id = '1983abe86992612accc037c20847d76430602a19cafd8db834b96d08ff93e0cf' 
  AND (
    token = 'OOb/H0P3sus8hVxtJmOJ3p/M15pHb1fq+qaD5+WTz4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044